package com.heima.home.exception;


import org.springframework.http.HttpStatus;

/**
 * 自定义业务异常类
 */
public class CustomException extends RuntimeException {

    private final int code;

    public CustomException(String message) {
        // 默认使用 400 Bad Request 状态码
        this(HttpStatus.BAD_REQUEST.value(), message);
    }

    public CustomException(int code, String message) {
        super(message);
        this.code = code;
    }

    public int getCode() {
        return code;
    }
}